package com.zhkj.txg.module.member.model

import com.zhkj.lib.http.BaseApiService
import com.zhkj.lib.http.BaseResponse
import com.zhkj.txg.module.member.entity.*
import com.zhkj.txg.module.mine.entity.UserCenterResponse
import com.zhkj.txg.module.order.entity.OrderPayResponse
import io.reactivex.Observable
import retrofit2.http.*

interface MemberApi : BaseApiService {
    @GET("api/member/index")
    fun memberCard(@Query("token") token: String): Observable<MemberCardResponse>

    @GET("api/member/goodsList")
    fun memberProductList(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") rows: Int
    ): Observable<MemberProductListResponse>

    @GET("api/member/goods")
    fun memberProduct(
        @Query("token") token: String,
        @Query("goods_id") goodsId: Long
    ): Observable<MemberProductResponse>

    @FormUrlEncoded
    @POST("api/member/pay")
    fun memberOrderPay(
        @Field("token") token: String,
        @Field("goods_id") goodsId: Long,
        @Field("goods_num") goodsNum: Int,
        @Field("item_id") specId: Long,
        @Field("address_id") addressId: Long,
        @Field("pay_type") payType: String,
        @Field("code") code: String
    ): Observable<OrderPayResponse>

    @GET("api/user/getDefaultAddress")
    fun getDefaultAddress(@Query("token") token: String): Observable<DefaultAddressResponse>

    @GET("api/member/invite")
    fun inviteList(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") rows: Int,
        @Query("type") type: Int
    ): Observable<InviteResponse>

    @GET("api/member/rebateLog")
    fun rebateLog(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") rows: Int,
        @Query("type") type: Int,
        @Query("time") time: String
    ): Observable<RebateLogResponse>

    @GET("api/member/RebateLogCount")
    fun rebateStatistics(@Query("token") token: String): Observable<RebateStatisticsResponse>

    @GET("api/member/total")
    fun totalMemberIncome(@Query("token") token: String): Observable<MemberIncomeResponse>

    @GET("api/member/rewardCenter")
    fun rewardCenter(@Query("token") token: String): Observable<RewardCenterResponse>

    @GET("api/member/rewardCalendar")
    fun memberCalender(@Query("token") token: String, @Query("date") date: String): Observable<MemberCalendarResponse>

    @GET("api/member/orderList")
    fun memberOrderList(
        @Query("token") token: String, @Query("page") page: Int,
        @Query("rows") rows: Int
    ): Observable<MemberOrderResponse>

    @GET("api/member/orderDetail")
    fun memberOrderDetail(
        @Query("token") token: String, @Query("id") id: Long
    ): Observable<MemberOrderDetailResponse>

    @FormUrlEncoded
    @POST("api/member/receipt")
    fun memberReceive(@Field("token") token: String, @Field("order_id") orderId: Long): Observable<BaseResponse>

    @FormUrlEncoded
    @POST("api/member/checkCode")
    fun checkCode(@Field("token") token: String, @Field("code") code: String): Observable<CheckResultResponse>

    @GET("api/user/index")
    fun userCenter(@Query("token") token: String): Observable<UserCenterResponse>
}